package plugins.delivery;

import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.cache.CacheFactory;
import kd.bos.cache.DistributeSessionlessCache;
import kd.bos.form.FormShowParameter;
import kd.sdk.plugin.Plugin;

import java.util.EventObject;

/**
 * 单据界面插件
 */
public class inVisableInvite extends AbstractBillPlugIn implements Plugin {

    public void afterCreateNewData(EventObject e) {
        super.afterCreateNewData(e);

        // 创建分布式无会话缓存
        DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");

        String identity = cache.get("deliveryIdentity");
        cache.remove("deliveryIdentity"); // 清除缓存，避免重复使用

        this.getView().showTipNotification("当前身份: " + identity);


        if ("user".equals(identity)) {
            this.getView().setVisible(false, "dcb4_invite");
        }
    }

}